(navigation image)
Home Animation & Cartoons | Arts & Music | Community Video | Computers & Technology | Cultural & Academic Films | Ephemeral Films | Movies | News & Public Affairs | Prelinger Archives | Spirituality & Religion | Sports Videos | Television | Videogame Videos | Vlogs | Youth Media
Search: Advanced Search
Anonymous User (login or join us) Upload

View movie

[item image]
View thumbnails
Run time: 17 minutes 7 seconds

Play / Download (help[help])

(22.7 M)Ogg Video
(41.4 M)h.264
(57.4 M)QuickTime


All Files: HTTP
[Attribution-Noncommercial-Share Alike 3.0]

Resources

Bookmark

Johan Falk/NodeOneLearn Drupal 13e: Form API introduction

You are using our new video/audio player!
I prefer flash (when possible)
Give us feedback!

This screencast is a part of the epic learning series "Four weeks of Drupal", chapter "Writing a module". You can view the full series at http://dev.nodeone.se/en/four-weeks-of-drupal.

Please post any comments over there, or we won't see them. Sorry.
---
Form API is one of the most important APIs when working with Drupal. It is used to build forms in a standardized and secure way, and will save you loads of time. This screencast shows an example implementation of form API, to build a text area and a submit button. In particular, this screencast includes:

* Using the drupal_get_form function as callback for a menu item
* Providing a form ID to drupal_get_form (and doing this with an array rather than a flat string)
* Using the t() function, and why that is a good idea
* The form API reference, found at http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html

code added/changed in wordlist.module

/**
* Implements hook_menu().
*/
function wordlist_menu() {
$items['admin/config/content/wordlist'] = array(
'title' => 'Word list',
'description' => 'Manage the list of globally available words on your site.',
'page callback' => 'drupal_get_form',
'page arguments' => array('wordlist_page'),
'access callback' => 'user_access',
'access arguments' => array('administer_site_configuration'),
'menu_name' => 'management',
);

return $items;
}

/**
* Builds the form for configuring Word list.
*/
function wordlist_page() {
$form['wordlist_words'] = array(
'#type' => 'textarea',
'#title' => t('Words to inlcude in the list'),
'#description' => t('The words included in this list will be available to Rules and other modules making use of the global "site" entity.'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save')
);

return $form;
}

---
This screencast is a part of the epic learning series "Four weeks of Drupal", chapter "Writing a module". You can view the full series at http://dev.nodeone.se/en/four-weeks-of-drupal.

Please post any comments over there, or we won't see them. Sorry.


This movie is part of the collection: Community Video

Producer: Johan Falk/NodeOne
Audio/Visual: sound
Keywords: Drupal; 4 weeks of Drupal; NodeOne; coding

Creative Commons license: Attribution-Noncommercial-Share Alike 3.0


Individual Files

Movie Files QuickTime h.264 Ogg Video
Drupal 13e - Form API introduction 57.4 MB
41.4 MB
22.7 MB
Image Files Animated GIF Thumbnail
Drupal 13e - Form API introduction 180.7 KB
3.4 KB
Information FormatSize
LearnDrupal13eFormApiIntroduction_files.xml Metadata [file]
LearnDrupal13eFormApiIntroduction_meta.xml Metadata 2.8 KB

Be the first to write a review
Downloaded 47 times
Reviews


Terms of Use (10 Mar 2001)